<%-- 
    Document   : panier.jsp
    Created on : 14 mai 2012, 13:54:51
    Author     : Attia
--%>

<%@page import="ecom.entity.AccountRemote"%>
<%@page import="ecom.entity.LigneRemote"%>
<%@page import="ecom.ejb.CartLocal"%>
<%@page import="ecom.entity.LigneRemote"%>
<%@page import="java.util.Set"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <link rel=stylesheet type="text/css" href="CSS/style.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Zombie Land</title>
    </head>
    <body>
        <jsp:include page="header.jsp" />
        <div id="product">

            <%
                String status = (String) request.getAttribute("status");

            %>
            <p>Status = <%= status%></p>
            <%
                double montant = 0.0;
                if (request.getAttribute("montant") != null) {
                    montant = (Double) request.getAttribute("montant");
                }
            %>
            <table id="allProduct">
                <tr>
                    <th scope="col">Icone</th>
                    <th scope="col">Produit</th>
                    <th nowrap scope="col">Quantity</th>
                    <th nowrap scope="col">Montant</th>
                </tr>	
                <%
                    if (request.getAttribute("llist") != null) {
                        Set<LigneRemote> pList = (Set<LigneRemote>) request.getAttribute("llist");
                        for (LigneRemote p : pList) {
                %>
                <tr>
                    <td><img src="<%= p.getProduct().getUrlImage()%>" alt="image du produit" width="50px" height="50px" /></td>
                    <td><%= p.getProduct().getName()%></td>
                    <td><%= p.getQuantite()%></td>
                    <td><%= p.getMontant()%></td>
                </tr>
                <% }%>
                <% }%>
            </table>
            <p>TOTAL = <%= montant%></p>
            <% if (session.getAttribute("account_logged") != null) {
                    AccountRemote ar = (AccountRemote) session.getAttribute("account_logged");

            %>
            <form name="form" action="TestServlet?action=buyCart" method="POST">
                <input type="text" id="iban" name="iban" value="<%= ar.getIban()%>" style="display:none;">
                <input id="submit" name="submit" type="submit" value="Valider" /></td>
            </form>
            <% }%>
        </div>
        <jsp:include page="footer.jsp" />
    </body>
</html>
